package com.zbkj.common.core;

import com.tiangong.framework.annotation.OpenApi;
import com.tiangong.framework.bo.CDO;
import com.tiangong.framework.bo.Return;
import com.zbkj.common.response.CommonResult;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;

@org.springframework.web.bind.annotation.RestController
public class RestController extends com.tiangong.framework.controller.RestController {
    @Override
    @RequestMapping({"/api/rest/**/*"})
    public CommonResult<Object> dispatcher(HttpServletRequest request) {
        Return ret = (Return)super.dispatcher(request);
        if(ret.getCode()==0){
            return CommonResult.success(ret.getData());
        }else {
            return CommonResult.failed(ret.getCode(),ret.getMsg());
        }
    }
}
